/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package org.fh.itsbankomat.businesslogic.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author MeinLaptop
 */
@Embeddable
public class BuchungssatzPK implements Serializable {
    @Basic(optional = false)
    @Column(name = "BUCHUNGSSATZID")
    private int buchungssatzid;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 34)
    @Column(name = "IBAN")
    private String iban;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 11)
    @Column(name = "BIC")
    private String bic;
    @Basic(optional = false)
    @NotNull
    @Column(name = "KUNDEID")
    private int kundeid;

    public BuchungssatzPK() {
    }

    public BuchungssatzPK(int buchungssatzid, String iban, String bic, int kundeid) {
        this.buchungssatzid = buchungssatzid;
        this.iban = iban;
        this.bic = bic;
        this.kundeid = kundeid;
    }

    public int getBuchungssatzid() {
        return buchungssatzid;
    }

    public void setBuchungssatzid(int buchungssatzid) {
        this.buchungssatzid = buchungssatzid;
    }

    public String getIban() {
        return iban;
    }

    public void setIban(String iban) {
        this.iban = iban;
    }

    public String getBic() {
        return bic;
    }

    public void setBic(String bic) {
        this.bic = bic;
    }

    public int getKundeid() {
        return kundeid;
    }

    public void setKundeid(int kundeid) {
        this.kundeid = kundeid;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) buchungssatzid;
        hash += (iban != null ? iban.hashCode() : 0);
        hash += (bic != null ? bic.hashCode() : 0);
        hash += (int) kundeid;
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof BuchungssatzPK)) {
            return false;
        }
        BuchungssatzPK other = (BuchungssatzPK) object;
        if (this.buchungssatzid != other.buchungssatzid) {
            return false;
        }
        if ((this.iban == null && other.iban != null) || (this.iban != null && !this.iban.equals(other.iban))) {
            return false;
        }
        if ((this.bic == null && other.bic != null) || (this.bic != null && !this.bic.equals(other.bic))) {
            return false;
        }
        if (this.kundeid != other.kundeid) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.fh.itsbankomat.businesslogic.model.BuchungssatzPK[ buchungssatzid=" + buchungssatzid + ", iban=" + iban + ", bic=" + bic + ", kundeid=" + kundeid + " ]";
    }
    
}
